<HTML><HEAD><TITLE>viewable_create(?ViewableName, +Elements, ++Type, ++LocNamesList)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(viewable)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>viewable_create(?ViewableName, +Elements, ++Type, ++LocNamesList)</H1>
Create a viewable, specifying both type and location names.
<DL>
<DT><EM>ViewableName</EM></DT>
<DD>A string or atom; the name of the new viewable.
</DD>
<DT><EM>Elements</EM></DT>
<DD>A list nested to at least a depth equal to the number of dimensions, or an array with sufficient dimensions (as created for example by dim/2) or a graph structure.
</DD>
<DT><EM>Type</EM></DT>
<DD>A ground term which is a valid viewable type. 
</DD>
<DT><EM>LocNamesList</EM></DT>
<DD>A list of lists of strings (location names) or a list of semantic markup terms from graph structures.
</DD>
</DL>
<H2>Description</H2>


        <p><B>NOTE:</B>When there are no registered visualisation clients,
        this predicate succeeds with any arguments, and has no effect.</P>

        <p>This predicate works exactly the same as
        <code>viewable_create/3</code> except that you have the added
        ability to set location names (e.g. row/column names) for
        arrays and to indicate which elements of the edge info
        structure should be attached to edge labels for graphs.

        <p>For array type viewables the <em>LocNamesList</em> argument
        should be a list as long as the number of dimensions in the
        viewable. The ith element <em>LocNames</em> of
        <em>LocNamesList</em> should be a list whose length is equal
        to the size of the ith dimension of the new viewable. The jth
        element of <em>LocNames</em> should be a ground string and
        this will become the name of the jth location of the ith
        dimension.  </P>

        <p>For graph type viewables the <em>LocNamesList</em> argument
        should be a list of the following form.

<pre>
[
 node_property([0->[name(NodeInfoName), label]]),
 edge_property([Index->[name(EdgeInfoName), label]])
]
</pre>

        Where <code>NodeInfoName</code> is a meaningful name for the
        information to be displayed at the nodes in the graph.  eg. If
        the graph represented a computer network, the nodes may show
        individual machine names. In such a case, <code>"machine
        name"</code> would be a likely candidate for the NodeInfoName
        argument.  Similarly <code>EdgeInfoName</code> refers to the
        information associated with edge labels.

        <p>The <code>Index</code> argument specifies which part of the
        edge info field should be shown on edges. 0:The whole edge
        info structure.  N:The Nth argument of the edge info
        structure.  [...,I,J,K]:The Kth argument of the Jth argument
        of the Ith argument... of the edge info structure. See below
        for examples.

        <p>For a more detailed description of creating viewables, refer to the
        documentation for <code>viewable_create/3</code>.</P>



<H3>Resatisfiable</H3>
no
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>ViewableName is not an atom, string or free variable.
<DT><EM>(1) general error </EM>
<DD>ViewableName is the name of an existent viewable.
<DT><EM>(1) general error </EM>
<DD>Elements is not a regular nested list or array with enough dimensions.
<DT><EM>(1) general error </EM>
<DD>Type is not a ground valid type.
<DT><EM>(5) type error </EM>
<DD>One of the viewable elements violates the element type.
<DT><EM>(5) type error </EM>
<DD>LocNamesList is not a correctly-sized list of correctly-sized lists of strings.
</DL>
<H2>Examples</H2>
<PRE>

            To create a 2 x 3 viewable, you could do:

            viewable_create(v1, [[A,B,C], [D,E,F]], 
                            array([fixed, fixed], any), 
                            [["foo", "bar"], ["tom", "dick", "harry"]]).

            This would have two rows (named "foo" and "bar") each
	    with three columns (named "tom", "dick" and
	    "harry").

            To create a graph viewable where node names are attached
            to node labels and edge info fields are attached to edge
            lables (ie info(1,foo(A)), info(2,foo(B)) and
            info(3,foo(C)) as per viewable_create/3).

            lib(graph_algorithms),
            make_graph_symbolic([](n1,n2,n3),
                                [edge(n1,n2,info(1,foo(A)),
                                 edge(n2,n3,info(2,foo(B)),
                                 edge(n1,n3,info(3,foo(C))], Graph),
            viewable_create(v2, Graph, graph(fixed),
                            [node_property([0-&gt;[name('node names'), label]]),
                             edge_property([0-&gt;[name('edge info'), label]])
                            ]).
                            

            To create a graph where the edges are labelled with the
            second argument of the edge info structure. (ie with the
            structures foo(A), foo(B) and foo(C))

            lib(graph_algorithms),
            make_graph_symbolic([](n1,n2,n3),
                                [edge(n1,n2,info(1,foo(A)),
                                 edge(n2,n3,info(2,foo(B)),
                                 edge(n1,n3,info(3,foo(C))], Graph),
            viewable_create(v2, Graph, graph(fixed),
                            [node_property([0-&gt;[name('node names'), label]]),
                             edge_property([2-&gt;[name('edge info'), label]])
                            ]).

            
            To create a graph where the edges are labelled with the
            first argument of the nested structure at the second
            argument of the edge info structure. (ie with the
            variables A, B and C)

            lib(graph_algorithms),
            make_graph_symbolic([](n1,n2,n3),
                                [edge(n1,n2,info(1,foo(A)),
                                 edge(n2,n3,info(2,foo(B)),
                                 edge(n1,n3,info(3,foo(C))], Graph),
            viewable_create(v2, Graph, graph(fixed),
                            [node_property([0-&gt;[name('node names'), label]]),
                             edge_property([[2,1]-&gt;[name('edge info'), label]])
                            ]).
            </PRE>
<H2>See Also</H2>
<A HREF="../../lib/viewable/viewable_create-2.html">viewable_create / 2</A>, <A HREF="../../lib/viewable/viewable_create-3.html">viewable_create / 3</A>, <A HREF="../../lib/viewable/viewable_expand-4.html">viewable_expand / 4</A>, <A HREF="../../lib/graph_algorithms/make_graph-3.html">graph_algorithms : make_graph / 3</A>
</BODY></HTML>
